<select id="<?php echo $selName;?>" name="<?php echo $selName;?>">
    <?php
    foreach ($tree as $key => $value):
        if ($value['Layer'] == 1): ?>
            <option value="<?php echo $value['CatagoryId']; ?>"><?php echo $value['Name']; ?></option>
    <?php else: ?>
                <option value="<?php echo $value['CatagoryId']; ?>"><?php echo str_repeat('&nbsp;&nbsp;&nbsp;', $value['Layer'] - 2) . '|--' . $value['Name']; ?></option>
    <?php endif;
            endforeach; ?>
</select>